extends Control

func move_pointer(node):
	if(!sys.changing_scene):
		sys.pointer_mover.interpolate_property(sys.pointer,"rect_position",sys.pointer.rect_position,Vector2(node.rect_global_position.x,node.rect_global_position.y+16),0.2,Tween.TRANS_CUBIC,Tween.EASE_OUT)
		sys.pointer_mover.interpolate_property(node,"rect_global_position",node.rect_global_position,Vector2(node.rect_global_position.x+40,node.rect_global_position.y),0.2,Tween.TRANS_CUBIC,Tween.EASE_OUT)
		sys.pointer_mover.start()

func reset_button(node,pos):
	if(!sys.changing_scene):
		sys.pointer_mover.interpolate_property(sys.pointer,"rect_position",sys.pointer.rect_position,Vector2(pos.x-60,pos.y+16),0.2,Tween.TRANS_CUBIC,Tween.EASE_OUT)
		sys.pointer_mover.interpolate_property(node,"rect_global_position",node.rect_global_position,pos,0.2,Tween.TRANS_CUBIC,Tween.EASE_OUT)
		sys.pointer_mover.start()

func start_mouse_on():
	move_pointer($"vbc/start")

func settings_mouse_on():
	move_pointer($"vbc/settings")

func about_mouse_on():
	move_pointer($"vbc/about")

func start_mouse_exit():
	reset_button($"vbc/start",Vector2(400,256))

func settings_mouse_exit():
	reset_button($"vbc/settings",Vector2(400,332))

func about_mouse_exit():
	reset_button($"vbc/about",Vector2(400,408))

func start_input(event):
	if(event is InputEventMouseButton):
		if(event.button_index==BUTTON_LEFT&&event.pressed):
			sys.start()

func settings_input(event):
	if(event is InputEventMouseButton):
		if(event.button_index==BUTTON_LEFT&&event.pressed):
			settings_mouse_exit()
			sys.open_settings()

func about_input(event):
	if(event is InputEventMouseButton):
		if(event.button_index==BUTTON_LEFT&&event.pressed):
			about_mouse_exit()
			sys.open_about()
